using System;
using Slobby.Common;
using Slobby.SharedNetworkTypes;

namespace Slobby.Client.Net {
    class PassthroughReciever : Reciever {

        Action<object> defaulth;
        Action<DisconnectedMessage> disconh;
        ServerConnection conn;

        public PassthroughReciever(ServerConnection connection, Action<object> defaultHandler, Action<DisconnectedMessage> disconnectedMessageHandler) {
            defaulth = defaultHandler;
            disconh = disconnectedMessageHandler;
            conn = connection;
        }

        public void Recieve(PingMessage ping) {
            conn.SendMessage(new PongMessage());
        }

        public void Recieve(DisconnectedMessage discon) {
            disconh(discon);
        }

        public override void Default(object o) {
            defaulth(o);
        }
    }
}
